<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>
    var z;
    //console.log(x);
    let x = 6;//没有变量提升
    console.log(x);


    if (true) {
      let y = 7;
      z = 8;
      console.log(y, z);
    }
    // console.log(y);
    console.log(z);


    var num = 6;//全局作用域(全局变量的暂时性死区)
    if (true) {
      num = 'admin';
      console.log(num);
      var num;//局部作用域
      console.log(num);
    }
  </script>
</body>

</html>